import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:series_play/comm/base/base_state.dart';
import 'package:series_play/generated/assets.dart';
import 'package:series_play/widget/app_color.dart';
import 'package:series_play/widget/app_image.dart';
import 'package:series_play/widget/app_refresh_view.dart';
import 'package:series_play/widget/app_text.dart';

import 'controller/wallet_unlock_record_controller.dart';

class WalletUnlockRecordPage extends StatefulWidget {
  const WalletUnlockRecordPage({super.key});

  @override
  State<WalletUnlockRecordPage> createState() => _WalletUnlockRecordPageState();
}

class _WalletUnlockRecordPageState
    extends
    BaseControllerState<
        WalletUnlockRecordPage,
        WalletUnlockRecordController
    > {
  @override
  Widget buildPage(BuildContext context) {
    return AppRefreshListView(
      padding: const EdgeInsets.all(16).w,
      listController: mController,
      itemBuilder: (context, index) {
        return Container(
          padding: const EdgeInsets.all(16).w,
          decoration: BoxDecoration(
            color: const Color(0xff292B34).withValues(alpha: 0.5),
            borderRadius: BorderRadius.circular(10).r,
          ),
          child: Row(
            children: [
              Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  AppText.title('任务奖励', color: AppColor.white),
                  4.verticalSpace,
                  AppText.title('11集', color: AppColor.colorA4893F , fontSize: 12,),
                  4.verticalSpace,
                  AppText.secondary('2022.01.01 10:00:00', color: AppColor.white_40 , fontSize: 12,),
                ],
              ),
              const Spacer(),
              AppText('+100', color: AppColor.white , fontSize: 26,),
              10.horizontalSpace,
              AppImage.assetsWith18(Assets.imagesIcGold),
              16.horizontalSpace,
            ],
          ),
        );
      },
      separatorBuilder: (context, index) {
        return 10.verticalSpace;
      },
      onRefresh: mController.onRefreshing,
      onLoad: mController.onLoadingMore,
    );
  }

  @override
  createController() {
    return WalletUnlockRecordController();
  }

  @override
  bool showDefaultBackground() {
    return true;
  }

  @override
  String getTitle() {
    return '剧集解锁记录';
  }
}
